<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
	<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/jquery.min.js"></script>
	<link href="../webjars/bootstrap/3.3.7-1/css/bootstrap.css" rel="stylesheet">
	<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/material-teal/easyui.css" />
	<link rel="stylesheet" href="../static/jquery-easyui-1.5.5.3/themes/icon.css" />
	<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../static/jquery-easyui-1.5.5.3/locale/easyui-lang-zh_CN.js"></script>
	<style type="text/css">
	
	</style>
	<script type="text/javascript">
		$(function(){
			$("#all_dzfp").datagrid({
				idField:'id',
				title:'电子发票',
				fitColumns:true,
				width:'100%',
				striped:true,
				loadMsg:'数据正在加载中....',
				rownumber:true,
				url:'listDzfp',
				frozenColumns:[
							[
						{
							field:'ck',
							width:50,
							checkbox:true
						}
					]
				],
				columns:[
					[
						{
							field:'id',
							title:'序号',
							width:100,
							align:'center'
						},{
							field:'lessee',
							title:'开票单位',
							width:100,
							align:'center',
							formatter:function(value){
								return value.name;
							}
						},{
							field:'number',
							title:'发票号码',
							width:100,
							align:'center'
						},{
							field:'serial',
							title:'编号',
							width:100,
							align:'center'
						},{
							field:'code',
							title:'发票代码',
							width:100,
							align:'center'
						},{
							field:'money',
							title:'缴费金额',
							width:100,
							align:'center'
						},{
							field:'date',
							title:'开票日期',
							width:100,
							align:'center'
						},{
							field:'name',
							title:'报销人',
							width:100,
							align:'center'
						},{
							field:'endDate',
							title:'报销时间',
							width:100,
							align:'center'
						}
					]
				],
				pagination:true,
				pageSize:5,
				pageList:[5,10,20,25,50 ],
				toolbar:[
					{
					text:'删除发票',
					iconCls:'icon-remove',
					handler:function(){
						var arr=$('#all_dzfp').datagrid('getSelections');
						if(arr.length<=0){
							$.messager.show({
								title:'提示信息',
								msg:'至少选中一条记录删除！'
							});
						}else{
							$.messager.confirm('提示信息','确认删除'+arr.length+'条数据吗？',function(r){
								if(r){
									var ids='';
									for(var i=0;i<arr.length; i++){
										ids+=arr[i].id+',';
									}
									ids = ids.substring(0, ids.length-1);
									$.post('deleteDzfp',{ids:ids},function(){
										//刷新数据表格
										$('#all_dzfp').datagrid('reload');
										//清空ID
										$('#all_dzfp').datagrid('unselectAll');
										$.messager.show({
											title:'提示信息',
											msg:'操作成功!'
										});
									});
								}else{
									return;
								}
							});
						}
					}
				}
					]
			});
		});
	</script>
</head>
<body>
<table id="all_dzfp"></table>
</body>
</html>